

function resizeWindow( obj )
{
   try
   {
      var w = getUserValue( "winID" );
      if( !obj.h || !obj.w || !w ) return;
      if( isFullScreen() )
      {
         showFullscreenWarning();
         return;
      } 
      var hw = {};
      // Sanity check.  Make sure everything is ACTUALLY a number
      hw.height = castToNumber( obj.h );
      hw.width  = castToNumber( obj.w );
      // Only the overall window size REALLY matters here (and it is the only thing which can really be set anyway).
      chrome.windows.update( w, hw );   
   }
   catch( e )
   {
      alert( e );
   }
}

function isFullScreen()
{
   if( window.screen.width == windw.innerWidth && window.screen.height == windw.innerHeight )
   {
      return true;
   }
   return false;
}

function showFullscreenWarning()
{
   alert( chrome.i18n.getMessage( "fullscreenError" ) );
}
